// Created by Xslt generator for Eclipse.
// XSL :  not found (java.io.FileNotFoundException:  (The system cannot find the path specified))
// Default XSL used : easystruts.jar$org.easystruts.xslgen.JavaClass.xsl

package com.ba360.struts.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import com.ba360.portal.common.PortalConstants;

/**
 * Form.java created by EasyStruts - XsltGen. http://easystruts.sf.net created
 * on 05-08-2004
 * 
 * XDoclet definition:
 * 
 * @struts:form name="ForgotPassword"
 */
public class ForgotPassword extends ActionForm {

	// --------------------------------------------------------- Instance
	// Variables

	/** userName property */
	private String userName;

	/** emailAddress property */
	private String emailAddress;

	// --------------------------------------------------------- Methods

	/**
	 * Method validate
	 * 
	 * @param ActionMapping
	 *            mapping
	 * @param HttpServletRequest
	 *            request
	 * @return ActionErrors
	 */
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {

		//throw new UnsupportedOperationException("Generated method
		// 'validate(...)' not implemented.");
		ActionErrors ae = new ActionErrors();
		//request.getHeader("referer");
		String action = (String) request.getParameter(PortalConstants.ACTION);
		if (action == null) {
			return ae;
		}

		if (action.equals("Reset")) {
			//throw new UnsupportedOperationException("Generated method
			// 'validate(...)' not implemented.");
			/*
			 * if (userName==null || userName.trim().length()==0) {
			 * ae.add("UserName", new ActionError("error.username.notindb"));
			 * return ae;
			 *  }
			 */
			if (emailAddress == null || emailAddress.trim().length() == 0) {
				ae.add("Password",
						new ActionError("error.emailaddress.notindb"));
				return ae;
			}
		}
		return ae;

	}

	/**
	 * Method reset
	 * 
	 * @param ActionMapping
	 *            mapping
	 * @param HttpServletRequest
	 *            request
	 */
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		userName = "";
		emailAddress = "";

	}

	/**
	 * Returns the userName.
	 * 
	 * @return String
	 */
	public String getUserName() {
		return userName;
	}

	/**
	 * Set the userName.
	 * 
	 * @param userName
	 *            The userName to set
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}

	/**
	 * Returns the emailAddress.
	 * 
	 * @return String
	 */
	public String getEmailAddress() {
		return emailAddress;
	}

	/**
	 * Set the emailAddress.
	 * 
	 * @param emailAddress
	 *            The emailAddress to set
	 */
	public void setEmailAddress(String emailAddress) {
		this.emailAddress = emailAddress;
	}

}